package com.zc.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.zc.domain.FourPointsItem;

@Repository
public interface IVibDao {
	@Select("SELECT timestamp,zd1,zd2,zd3,zd4 FROM ${tableName} ORDER BY timestamp DESC LIMIT 1;")
	@Results({
		@Result(column = "timeStamp",property = "timeStamp"),
		@Result(column = "zd1",property = "data_1"),
		@Result(column = "zd2",property = "data_2"),
		@Result(column = "zd3",property = "data_3"),
		@Result(column = "zd4",property = "data_4"),
	})
	FourPointsItem getVibration(@Param("tableName") String tableName);
	
	
	@Select("SELECT TimeStamp,zd1,zd2,zd3,zd4 FROM ${tableName} WHERE TimeStamp>'${date}' ORDER BY TimeStamp DESC;")
	@Results({
		@Result(column = "TimeStamp",property = "timeStamp"),
		@Result(column = "zd1",property = "data_1"),
		@Result(column = "zd2",property = "data_2"),
		@Result(column = "zd3",property = "data_3"),
		@Result(column = "zd4",property = "data_4"),
	})
	List<FourPointsItem> getTodayVib(@Param("tableName") String tableName,@Param("date") String date);
}
